<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>张芃 - 一个博客</title><meta name="author" content="张芃"><meta name="copyright" content="张芃"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta property="og:type" content="website">
<meta property="og:title" content="张芃">
<meta property="og:url" content="https://zhangpeng-1304089575.cos-website.ap-shanghai.myqcloud.com/index.html">
<meta property="og:site_name" content="张芃">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://zhangpeng-1304089575.cos-website.ap-shanghai.myqcloud.com/img/avatar.jpg">
<meta property="article:author" content="张芃">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://zhangpeng-1304089575.cos-website.ap-shanghai.myqcloud.com/img/avatar.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://zhangpeng-1304089575.cos-website.ap-shanghai.myqcloud.com/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '张芃',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2022-02-11 14:27:13'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.0.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/img/avatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">23</div></a></div><div class="data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">11</div></a></div><div class="data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fa fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fa fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">张芃</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fa fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fa fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">张芃</h1></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left"><a href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E4%B8%ADkey%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86/" title="Vue中key的工作原理"><img class="post_bg" src="/img/vue.svg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Vue中key的工作原理"></a></div><div class="recent-post-info"><a class="article-title" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E4%B8%ADkey%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86/" title="Vue中key的工作原理">Vue中key的工作原理</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-02-10T16:00:00.000Z" title="发表于 2022-02-11 00:00:00">2022-02-11</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/">Vue</a></span></div><div class="content">
key可以唯一确定一个dom元素，从而执行diff算法更高效

1、key的作用主要是为了高效的更新虚拟DOM，其原理是vue在patch过程中通过key可以精准的判断两个节点是否是同一个，从而避免频繁更新不同元素，使得整个patch过程更加高效，减少了dom的操作量，提高性能
2、如果不设置key可能在列表更新时引发一些隐藏的bug 比如说更新和不更新看不出来。
3、vue中在使用相同标签名元素的过渡切换是，也会用到key属性，其目的也是为了让vue可以区分他们，否则vue只会替换其内部属性而不会触发过渡效果。需要用key来作为唯一性的判断。

作者：十九万里链接：https://juejin.cn/post/7017693252820303903来源：稀土掘金著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。

</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E5%87%BD%E6%95%B0%E5%BC%8F%E7%BB%84%E4%BB%B6/" title="Vue函数式组件"><img class="post_bg" src="/img/vue.svg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Vue函数式组件"></a></div><div class="recent-post-info"><a class="article-title" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E5%87%BD%E6%95%B0%E5%BC%8F%E7%BB%84%E4%BB%B6/" title="Vue函数式组件">Vue函数式组件</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-02-10T16:00:00.000Z" title="发表于 2022-02-11 00:00:00">2022-02-11</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/">Vue</a></span></div><div class="content">函数式组件

无状态
无法实例化
内部没有任何生命周期处理函数轻量,渲染性能高,适合只依赖于外部数据传递而变化的组件(展示组件，无逻辑和状态修改)
在template标签里标明functional
只接受props值

12345678910&lt;template functional&gt;	&lt;div&gt;&#123;&#123;data&#125;&#125;&lt;/div&gt;&lt;template&gt;&lt;script&gt;export default &#123;	props: &#123;		data: &#x27;&#x27;	&#125;&#125;&lt;/script&gt;
</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E7%89%B9%E6%80%A7%E6%80%BB%E7%BB%93/" title="Vue特性总结"><img class="post_bg" src="/img/vue.svg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Vue特性总结"></a></div><div class="recent-post-info"><a class="article-title" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E7%89%B9%E6%80%A7%E6%80%BB%E7%BB%93/" title="Vue特性总结">Vue特性总结</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-02-10T16:00:00.000Z" title="发表于 2022-02-11 00:00:00">2022-02-11</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/">Vue</a></span></div><div class="content">v-if和v-for两个同时出现
v-for优先于v-if被解析
同时出现,每次渲染都会限制性循环再判断条件,浪费性能
如何避免:可以外层嵌套template进行v-if,或者用compute过滤数据

data为什么必须是函数
同一个组件被复用多次会创建多个实例,在多实例的时候,为了保护互相之间的状态不干扰,不污染

diff算法虚拟dom中都有diff算法
diff算法能精确的比较新旧虚拟DOM中的key的变化，从而提高更新效率
执行方式：深度优先，同级比较
vue组件化
组件是独立和可复用的代码组织单元
组件化开发能大幅提高应用开发效率,测试性,复用性
遵循单向数据流的原则
组件内高内聚低耦合

在执行组件的时候，每一个组件会对应一个watcher，组件边变化的时候只会调用组件里面的渲染函数，可以把经常发生数据变化的单独放一个组件中，后期只需要执行这一个函数，起到局部刷新的作用。
为什么Vue采用异步渲染Vue 是组件级更新，如果不采用异步更新，那么每次更新数据都会对当前组件进行重新渲染，所以为了性能， Vue 会在本轮数据更新后，在异步更新视图
keep-alivekeep-a ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/ElementUI/%E8%87%AA%E5%AE%9A%E4%B9%89table/" title="自定义el-table">自定义el-table</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-02-10T16:00:00.000Z" title="发表于 2022-02-11 00:00:00">2022-02-11</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/">Vue</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/ElementUI/">ElementUI</a></span></div><div class="content">项目需求要改变表格颜色
12345678910111213141516171819202122232425262728293031323334353637383940&lt;style&gt;/* el-table的className是lb-table *//* 边框颜色*/.lb-table,.lb-table th,.lb-table td,.lb-table th.is-leaf,.lb-table--border,.lb-table--group &#123;  border-color: #2cb5d0;&#125;.lb-table--border::before,.lb-table--border::after,.lb-table--group::after,.lb-table::before,.lb-table::after &#123;  background-color: #2cb5d0;&#125;.lb-table__body tr &#123;  height: 80px;&#125;.lb-table .cell &#123;  white-space: p ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2022/02/10/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/%E8%A7%A3%E5%86%B3node-sass%E7%9A%84%E5%AE%89%E8%A3%85%E9%97%AE%E9%A2%98/" title="解决node-sass的安装问题"><img class="post_bg" src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="解决node-sass的安装问题"></a></div><div class="recent-post-info"><a class="article-title" href="/2022/02/10/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/%E8%A7%A3%E5%86%B3node-sass%E7%9A%84%E5%AE%89%E8%A3%85%E9%97%AE%E9%A2%98/" title="解决node-sass的安装问题">解决node-sass的安装问题</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2022-02-09T16:00:00.000Z" title="发表于 2022-02-10 00:00:00">2022-02-10</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/">CSS</a></span></div><div class="content">由于node-sass的安装很麻烦,而且已经被sass的开发团队弃用,所以转而选择dart-sass但是有一些框架必须要node-sass才能运行,比如在开发uni-app的时候发现,如果直接安装dart-sass,在run的时候会报错找不到node-sass,uni-app应该是只认node-sass的包名,所以百度到了下面的的方法:

123&gt;//由于npm6.9以上支持新功能package alias对包重命名&gt;// 可以既满足包名为node-sass，但实际是使用的dart-sass的效果&gt;npm install node-sass@npm:dart-sass 
</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2021/10/19/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E5%88%86%E7%8E%AF%E5%A2%83%E6%89%93%E5%8C%85/" title="Vue分环境打包"><img class="post_bg" src="/img/vue.svg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Vue分环境打包"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/10/19/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E5%88%86%E7%8E%AF%E5%A2%83%E6%89%93%E5%8C%85/" title="Vue分环境打包">Vue分环境打包</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-18T16:00:00.000Z" title="发表于 2021-10-19 00:00:00">2021-10-19</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/">Vue</a></span></div><div class="content">vue打包的时候经常需要分别给测试服务器和正式服务器部署,如果两个环境需要配置的环境变量不同,只用npm run build的方法每次都要改环境变量。在package.json 里的 scripts列出了打包对应的环境,cli创建的项目默认有serve和build,如果需要加一个打包环境,可以在scripts里加&quot;build:stage&quot;: &quot;vue-cli-service build --mode staging&quot;。然后在根目录新增.env.staging文件,内容参照.env.development
</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2021/09/28/%E6%9C%8D%E5%8A%A1/Ubutun%E5%AE%89%E8%A3%85Jenkins/" title="Ubuntu安装Jenkins"><img class="post_bg" src="/img/jenkins.svg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Ubuntu安装Jenkins"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/09/28/%E6%9C%8D%E5%8A%A1/Ubutun%E5%AE%89%E8%A3%85Jenkins/" title="Ubuntu安装Jenkins">Ubuntu安装Jenkins</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-27T16:00:00.000Z" title="发表于 2021-09-28 00:00:00">2021-09-28</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span></div><div class="content">我并没有用docker部署jenkins,因为不想在docker里启动jenkins再运行docker项目,所以直接装在了ubuntu服务器里
1.Ubuntu安装Jenkins123456789101112131415161718192021# 判断是否安装jdkjava -version# 如果没有安装jdk，则安装jdksudo apt-get install openjdk-8-jdk# 再次查看jdkjava -version# 将存储库密钥添加到系统wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -# 将Debian包存储库地址附加到服务器的sources.list echo deb http://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.listsudo apt-get updatesudo apt-get install jenkins# 启 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2021/09/08/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/SCSS%E6%B7%B7%E5%85%A5/" title="SCSS混入"><img class="post_bg" src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="SCSS混入"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/09/08/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/SCSS%E6%B7%B7%E5%85%A5/" title="SCSS混入">SCSS混入</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-07T16:00:00.000Z" title="发表于 2021-09-08 00:00:00">2021-09-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/">CSS</a></span></div><div class="content">@mixin：
@mixin指令允许您定义可以在整个样式表中重复使用的样式，而避免了使用无语意的类（class），混入(@mixin)还可以包含所有的 CSS 规则，以及任何其他在 Sass 文档中被允许使用的东西，甚至可以携带 arguments，引入变量等，这就意味着只需少量的混入(@mixin)代码就能输出多样化且不重复的样式。

调用时 @include xxx
定义混入(@mixin)混入通过 @mixin 类名 后面跟任选的arguments参数的方式定义一个 Mixins 模块，然后添加任何你想重复使用的样式：
12345@mixin vertical-center &#123; //纵向居中  position: relative;  top: 50%;  transform: translateY(-50%);&#125;

当定义一个混入(@mixin)的时候，参数被作为变量名，写到混入(@mixin)名字后面的括号内，多个参数可以用逗号分隔，当调用混入的时候，值通过对应的参数顺序被传递。
1234567891011121314@mixin textEllipsis ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2020/12/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/Kotlin%20DLS%20%E6%9E%84%E5%BB%BA%20gradle/" title="Kotlin DLS 构建 gradle"><img class="post_bg" src="/img/gradle.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Kotlin DLS 构建 gradle"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/12/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/Kotlin%20DLS%20%E6%9E%84%E5%BB%BA%20gradle/" title="Kotlin DLS 构建 gradle">Kotlin DLS 构建 gradle</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-12-10T16:00:00.000Z" title="发表于 2020-12-11 00:00:00">2020-12-11</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/">Android</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/Kotlin/">Kotlin</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/Kotlin/Gradle/">Gradle</a></span></div><div class="content">Kotlin DLS 构建 gradle修改gradle
Gradle的Kotlin DSL提供了传统Groovy DSL的替代语法，并在受支持的IDE中提供了增强的编辑体验，并具有出色的内容辅助，重构，文档等功能，这是官方给出的一些定义，当然，他也是有限制的，所以尽可能的保证Gradle和Android版本为最新版本是很有必要的，当然，JDK的版本至少是在8或者以上，有了这些铺垫之后，我们就可以开始着手来改造一个项目了
我们先区分一些语法的不同
1.Groovy字符串可以用单引号’string’或双引号引起来”string”，而Kotlin需要双引号”string”。
2.Groovy允许在调用函数时省略括号，而Kotlin始终需要括号。
3.Gradle Groovy DSL允许&#x3D;在分配属性时省略赋值运算符，而Kotlin始终需
要赋值运算符。
然后我们要知道，一个基于Gradle构建的项目，默认会有哪些配置文件？
settings.gradle
project&#x2F;build.gradle
app&#x2F;build.gradle———————————————— ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2020/11/09/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/Android%20%E5%BC%80%E6%BA%90/" title="Android 开源 部分不常用的收集"><img class="post_bg" src="/img/android.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Android 开源 部分不常用的收集"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/11/09/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/Android%20%E5%BC%80%E6%BA%90/" title="Android 开源 部分不常用的收集">Android 开源 部分不常用的收集</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-11-08T16:00:00.000Z" title="发表于 2020-11-09 00:00:00">2020-11-09</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/">Android</a></span></div><div class="content">Android 开源


Android 页面底部和侧边的导航栏

https://github.com/tyzlmjj/PagerBottomTabStrip




KunMinXLinkage-RecyclerView一行代码即可接入二级联动列表

https://github.com/KunMinX/Linkage-RecyclerView



Android-skin-support一款 Android 换肤框架

https://github.com/ximsfei/Android-skin-support



[ BubbleSeekBar]A beautiful Android custom seek bar, which has a bubble view with progress appearing upon when seeking. Highly customizable, mostly demands has been considered

https://github.com/woxingxiao/BubbleSeekBar



BaseRecyc ...</div></div></div><nav id="pagination"><div class="pagination"><span class="page-number current">1</span><a class="page-number" href="/page/2/#content-inner">2</a><a class="page-number" href="/page/3/#content-inner">3</a><a class="extend next" rel="next" href="/page/2/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/img/avatar.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">张芃</div><div class="author-info__description"></div></div><div class="card-info-data is-center"><div class="card-info-data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">23</div></a></div><div class="card-info-data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">11</div></a></div><div class="card-info-data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/zhangpeng_git"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E4%B8%ADkey%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86/" title="Vue中key的工作原理"><img src="/img/vue.svg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Vue中key的工作原理"/></a><div class="content"><a class="title" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E4%B8%ADkey%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86/" title="Vue中key的工作原理">Vue中key的工作原理</a><time datetime="2022-02-10T16:00:00.000Z" title="发表于 2022-02-11 00:00:00">2022-02-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E5%87%BD%E6%95%B0%E5%BC%8F%E7%BB%84%E4%BB%B6/" title="Vue函数式组件"><img src="/img/vue.svg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Vue函数式组件"/></a><div class="content"><a class="title" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E5%87%BD%E6%95%B0%E5%BC%8F%E7%BB%84%E4%BB%B6/" title="Vue函数式组件">Vue函数式组件</a><time datetime="2022-02-10T16:00:00.000Z" title="发表于 2022-02-11 00:00:00">2022-02-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E7%89%B9%E6%80%A7%E6%80%BB%E7%BB%93/" title="Vue特性总结"><img src="/img/vue.svg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Vue特性总结"/></a><div class="content"><a class="title" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/Vue%E7%89%B9%E6%80%A7%E6%80%BB%E7%BB%93/" title="Vue特性总结">Vue特性总结</a><time datetime="2022-02-10T16:00:00.000Z" title="发表于 2022-02-11 00:00:00">2022-02-11</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2022/02/11/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/ElementUI/%E8%87%AA%E5%AE%9A%E4%B9%89table/" title="自定义el-table">自定义el-table</a><time datetime="2022-02-10T16:00:00.000Z" title="发表于 2022-02-11 00:00:00">2022-02-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/02/10/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/%E8%A7%A3%E5%86%B3node-sass%E7%9A%84%E5%AE%89%E8%A3%85%E9%97%AE%E9%A2%98/" title="解决node-sass的安装问题"><img src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="解决node-sass的安装问题"/></a><div class="content"><a class="title" href="/2022/02/10/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/%E8%A7%A3%E5%86%B3node-sass%E7%9A%84%E5%AE%89%E8%A3%85%E9%97%AE%E9%A2%98/" title="解决node-sass的安装问题">解决node-sass的安装问题</a><time datetime="2022-02-09T16:00:00.000Z" title="发表于 2022-02-10 00:00:00">2022-02-10</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            <a class="card-more-btn" href="/categories/" title="查看更多">
    <i class="fas fa-angle-right"></i></a>
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Java/"><span class="card-category-list-name">Java</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Linux/"><span class="card-category-list-name">Linux</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/"><span class="card-category-list-name">大前端</span><span class="card-category-list-count">20</span></a><ul class="card-category-list child"><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/"><span class="card-category-list-name">Android</span><span class="card-category-list-count">13</span></a><ul class="card-category-list child"><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/Kotlin/"><span class="card-category-list-name">Kotlin</span><span class="card-category-list-count">1</span></a><ul class="card-category-list child"><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Android/Kotlin/Gradle/"><span class="card-category-list-name">Gradle</span><span class="card-category-list-count">1</span></a></li></ul></li></ul></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/"><span class="card-category-list-name">CSS</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Vue/"><span class="card-category-list-name">Vue</span><span class="card-category-list-count">5</span></a></li></ul></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/tags/%E6%A8%A1%E6%9D%BF/" style="font-size: 1.15em; color: rgb(9, 50, 162)">模板</a><a href="/tags/Android/" style="font-size: 1.45em; color: rgb(58, 59, 4)">Android</a><a href="/tags/Kotlin/" style="font-size: 1.15em; color: rgb(116, 169, 97)">Kotlin</a><a href="/tags/Java/" style="font-size: 1.15em; color: rgb(170, 20, 158)">Java</a><a href="/tags/SCSS/" style="font-size: 1.25em; color: rgb(162, 39, 138)">SCSS</a><a href="/tags/CSS/" style="font-size: 1.25em; color: rgb(192, 102, 92)">CSS</a><a href="/tags/Linux/" style="font-size: 1.15em; color: rgb(85, 163, 156)">Linux</a><a href="/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" style="font-size: 1.15em; color: rgb(181, 182, 40)">服务器</a><a href="/tags/%E6%9C%8D%E5%8A%A1%E9%83%A8%E7%BD%B2/" style="font-size: 1.15em; color: rgb(118, 142, 128)">服务部署</a><a href="/tags/VUE/" style="font-size: 1.35em; color: rgb(57, 194, 99)">VUE</a><a href="/tags/Gradle/" style="font-size: 1.15em; color: rgb(70, 154, 180)">Gradle</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span><a class="card-more-btn" href="/archives/" title="查看更多">
    <i class="fas fa-angle-right"></i></a></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/02/"><span class="card-archive-list-date">二月 2022</span><span class="card-archive-list-count">5</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/10/"><span class="card-archive-list-date">十月 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/09/"><span class="card-archive-list-date">九月 2021</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/12/"><span class="card-archive-list-date">十二月 2020</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/11/"><span class="card-archive-list-date">十一月 2020</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/07/"><span class="card-archive-list-date">七月 2020</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/04/"><span class="card-archive-list-date">四月 2020</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/03/"><span class="card-archive-list-date">三月 2020</span><span class="card-archive-list-count">1</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">23</div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2022-02-11T06:27:13.007Z"></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By 张芃</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js"></script><div class="js-pjax"></div><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script></div></body></html>